from django_filters import FilterSet
import django_filters
from .models import *


class UserListFilter(FilterSet):

    username = django_filters.CharFilter(
        field_name='username',
        lookup_expr='icontains'
    )
    time_start = django_filters.DateFilter(
        field_name='date_joined',
        lookup_expr='gt'
    )
    time_end = django_filters.DateFilter(
        field_name='date_joined',
        lookup_expr='lt'
    )
    is_active = django_filters.BooleanFilter(
        field_name='is_active',
    )
    groups = django_filters.NumberFilter(
        field_name='groups__id'
    )
